package SwordFingerOffer;

public class Q55_1_TreeDepth {
    //计算树的深度
    public int maxDepth(TreeNode root) {
        if (root == null){
            return 0;
        }
       return process(root, 1);
    }

    public int process(TreeNode root, int depth) {
        if (root == null){
            return depth - 1;
        }
        return Math.max(process(root.left, depth + 1), process(root.right, depth + 1));

    }
}
